/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.controller;

import java.io.File;
import java.io.FileOutputStream;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import org.apache.jasper.tagplugins.jstl.core.Url;

import org.apache.log4j.Logger;

import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;


import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import queenb.net.entitybean.*;
import queenb.web.crm.store.CustomerStore;
import queenb.web.crm.store.K100Store;
import queenb.web.crm.store.N850Store;
import queenb.web.inteface.EmployeeInf;
import queenb.web.inteface.Q100Inf;
import queenb.web.store.ContactStore;
import queenb.web.store.EmployeeStore;
import queenb.web.store.L200Store;
import queenb.web.store.M650Store;
import queenb.web.store.N350Store;
import queenb.web.store.N450Store;
import queenb.web.store.Q100Store;
import queenb.web.supplier.store.T025Store;
import queenb.web.util.ComboboxUtil;
import queenb.web.util.ContextUtil;
import queenb.web.util.ResourcesProvider;
import queenb.web.util.SessionProvider;
import queenb.web.util.Util;

/**
 *
 * @author Thanh Luan
 */
public class EmployeeController extends QueenbController {

    private static Logger logger = Logger.getLogger(EmployeeController.class);
    // Thanh Luan Start Create 15/05/2012
    private String nv102;//ho 
    private String nv103;//ten
    private Date dateBorn;//nd118
    private boolean democheck;
    private EmployeeInf empInf;
    private EmployeeStore employeeStore;
    private Q100Inf q100Inf;
    private String sexChangeItem = "M";
    private String industry;
    private String status_family;
    private String nv110;//titile
    private String fullName;
    private int FREFIX_MODULE = 7;
    private int FPEFIX_FH00 = 99;
    private String number;
    private String nv102_nv103;
    private String nv107;
    private String nv113;
    private String nv127;// chu lot
    private String nv112;
    private String nv251;
    private String nv962;//email
    private String nv958;//mobi
    private String nv967;//tel
    private String nv106;//dang nhap
    private List<N100> listEmployee;
    private List<N100> listEmployeeDB;
    private List<EmployeeController> listEmployeeBean = null;
    private int pn100;
    private String idSearch;
    private String messageform = "";
    private N100 n100;
    private int pm650;
    private int pq100;
    private List<N100> listSelected = new ArrayList<N100>();
    private List<N500> listSelectedN500 = new ArrayList<N500>();
    private List<N100> listAllEmp = new ArrayList<N100>();
//    public static int pnPN100Detail;//Cac controller tham chieu den
    List<N100> listN100 = null;
    List<EmployeeController> cletter = null;
    private char alpha;
    private String avata = "";
    private boolean flag;
    //checked for checkbox
    private boolean check = true;
    private boolean flagCheckLogin;
    private int FN600 = 1;
    private int fk100 = 0;
    private String active_nv106;
    private int beginContructor;
    private boolean result;
    private String keySearch;
    private String id_search;
    private int typeSearch = 0;
    private ComboboxUtil comboboxUtil;
    private int fn450;// id bộ phận
    private int fn850;// id nhóm tổ
    private List<SelectItem> combN250 = new ArrayList<SelectItem>();// danh sách chức vụ
    private int fn250;// Chức vụ
    private List<N450> listn450i;
    private int grouppart;
    // Tung start
    private String nv961;//mobiphone;
    private String nv968;//sky
    private String nv969;//yahoo
    private String nv952;//diachi
    private String nv955;//Quan/Huyen
    private String nv957;//tinh thanh
    private String nv960;//note
    private String nv954;// address 2
    private String nv973;// Email
    private String nv974;// Email 2
    private String nv975;// Email 3
    private N950Controller n950Controller;
    private Date ld201;
    private Date ld202;
    private int ln203;
    private int ln204;
    private int ln205;
    private int ln206;
    private int ln207;
    private String lv208;
    private int ln209;
    private int ln210;
    private String lv211;
    private String lv212;
    private int ln213;
    private String lv214;
    private String lv224;
    private String ln203st;
    private String ln204st;
    private String ln205st;
    private String ln213st;
    private String ln207st;
    private String nv354p = "";
    private String nv354c = "";
    private String nv351p = "";
    private String nv351c = "";
    private boolean nn355c = true;
    private boolean nn355p = false;
    private Date nd352c = null;
    private Date nd353c = null;
    private Date nd352p = null;
    private Date nd353p = null;
    private int nn355;//phan biệt CMND và Passport
    private int pn350c = 0;
    private int pn350p = 0;
    private int PT025;
    private int REFID;
    private String TV026;
    private String TV027;// Code Ngan hang  
    private String TV028;// Ngoai te
    private String TV029;// Ngan hang
    private String TV030;// Dia chi
    private int fh200;
    private String menusub;
    private int fk600;// phan bviet khach hang ca nhan
    // end
    //paging
    private Date startDT;
    private Date endDT;
    private int Offset = 0;
    private int Limit = 30;
    private int totalrow; // tong so dong
    private int totalpage; // tong so trang
    private int current; // traung hien tai
    static private int numrow = 30; // so dong tren 1 trang
    private int start; // bat dau lay tu record
    private int end; // lay tu record so
    private int startpage = 1; // page bat dau
    private int endpage = 1;   // page ket thuc
    private String pagename = "";
    private int totalcurent;
    private int typesearchcurent;
    private List<SelectItem> groupN450;
    private List<SelectItem> groupN850;
    private List<SelectItem> groupOther;
    private int fk400;//id nhom khac
    private String kv402 = "N100E";
    private String empString;//kiem tra acion redirect ve trang khi dong popupup sms
    private Workbook wb = new HSSFWorkbook();
    private int currentRow = 0;
    private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    private String tabString = "TABLL";// choose tab
    private List<N500> listN500DB;

    public EmployeeController() throws SQLException, InstantiationException, IllegalAccessException {
//       

        Object objempString = getRequest().getParameter("redirect");
        if (objempString != null) {
            this.empString = objempString.toString();
        }
        comboboxUtil = new ComboboxUtil();
        SearchController searchController = new SearchController();
        id_search = searchController.searchAlphaString();
        //  System.out.println("-------7&&&&&&&&&&&&&&&&&&&&-------" + id_search);

        getKapiMenu().setAdmin(false);
        getKapiMenu().setMainmenu1("m11");
        Object listselect = SessionProvider.getSessionMapValue(getKapiMenu().getListSelectedEx());

        if (listselect == null) {
            //SessionProvider.setSessionMapValue("listSelectedEx", listSelected);
            SessionProvider.setSessionMapValue(getKapiMenu().getListSelectedEx(), listSelected);

        } else {
            try {
                listSelectedN500 = (List<N500>) listselect;
            } catch (Exception e) {
                listSelectedN500 = new ArrayList<N500>();
            }
        }
        if (listselect == null) {
            //SessionProvider.setSessionMapValue("listSelectedEx", listSelected);
            SessionProvider.setSessionMapValue(getKapiMenu().getListSelectedEx(), listSelected);

        } else {
            try {
                listSelected = (List<N100>) listselect;
            } catch (Exception e) {
                listSelected = new ArrayList<N100>();
            }
        }
        if (listselect != null) {
        }
        Object listBeanDB = SessionProvider.getSessionMapValue("ListSMSEmployeeDB");
        if (listBeanDB == null) {
            SessionProvider.setSessionMapValue("ListSMSEmployeeDB", listEmployeeDB);
        } else {
            try {
                listEmployeeDB = (List<N100>) listBeanDB;
            } catch (Exception e) {
                listEmployeeDB = new ArrayList<N100>();
            }
        }
        Object listBean = SessionProvider.getSessionMapValue("ListSMSEmployee1");

        if (listBean == null) {
            SessionProvider.setSessionMapValue("ListSMSEmployee1", listEmployee);
        } else {
            try {
                listEmployee = (List<N100>) listBean;
            } catch (Exception e) {
                listEmployee = new ArrayList<N100>();
            }
        }
        searchAlphaEmployee();
        //page
        employeeStore = new EmployeeStore();
        Object pn100A = getRequest().getParameter("pn100A");
        if (pn100A != null) {
            this.pn100 = Integer.parseInt(pn100A.toString());
            listN100 = getListN100ById(pn100);

        }
        try {
            Object action1 = getRequest().getParameter("action");
            if (action1.equals("linkEmp")) {
                Object objPN1001 = getRequest().getParameter("pnPN100");
                if (objPN1001 != null) {
                    pn100 = Integer.parseInt(objPN1001.toString());

                }
            } else if (action1.equals("editHD")) {
                Object objPN100 = getRequest().getParameter("pn100");
                if (objPN100 != null) {
                    pn100 = Integer.parseInt(objPN100.toString());
                    SessionProvider.setSessionMapValue("PN100HD", pn100);
                }
                getNCURPKS_LISTOFTABN100NHD(pn100);
            } else if (action1.equals("functionSearch")) {
                Object keyStr = getRequest().getParameter("keysearch");
                keySearch = keyStr.toString();

                Object typeint = getRequest().getParameter("typesearch");
                if (typeint != null) {
                    typeSearch = Integer.parseInt(typeint.toString());
                    if (typeSearch == 0) {
                        pagename = "ALL";
                    }
                }
                System.out.println("----------KEY SEARCH-------" + keySearch + "---TYPE---" + typeSearch + "--PAGE---" + pagename);
            } else if (action1.equals("getitemvaluePn100")) {
                Object objPN100 = getRequest().getParameter("pn100");
                if (objPN100 != null) {
                    pn100 = Integer.parseInt(objPN100.toString());
                    SessionProvider.setSessionMapValue("PN100HD", pn100);
                }
            } else if (action1.equals("employeeHD")) {
                Object objPN100 = getRequest().getParameter("pn100");
                if (objPN100 != null) {
                    pn100 = Integer.parseInt(objPN100.toString());
                    SessionProvider.setSessionMapValue("PN100HD", pn100);
                }
                getNCURPKS_LISTOFTABN100NHD(pn100);

            } else if (action1.equals("convertcustomer")) {
                Object objectfk600 = getRequest().getParameter("kf600");
                if (objectfk600 != null) {
                    fk600 = Integer.parseInt(objectfk600.toString());
                }
                Object objPN100 = getRequest().getParameter("pn100");
                if (objPN100 != null) {
                    pn100 = Integer.parseInt(objPN100.toString());
                }



                //   updateemployeetocustomer(pn100);
            } else if (action1.equals("updatechucvu")) {

                Object objPN100 = getRequest().getParameter("pn100N250");
                if (objPN100 != null) {
                    pn100 = Integer.parseInt(objPN100.toString());
                }



                //   updateemployeetocustomer(pn100);
            } else if (action1.equals("addCusp100")) {
                if (SessionProvider.getSessionMapValue("listSelected") != null) {
                    SessionProvider.removeSessionMapValue("listSelected");
                }
                if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                    SessionProvider.removeSessionMapValue("listSelectedEx");
                }
                if (SessionProvider.getSessionMapValue("listPersonalDSVN") != null) {
                    SessionProvider.removeSessionMapValue("listPersonalDSVN");
                }
                if (SessionProvider.getSessionMapValue("listPersonalDSDD") != null) {
                    SessionProvider.removeSessionMapValue("listPersonalDSDD");
                }
                Object f = getRequest().getParameter("p100");
                Object s = getRequest().getParameter("valueC");
                if ("false".equals(s.toString())) {
                    for (int i = 0; i < listSelected.size(); i++) {
                        if (listSelected.get(i).pn100 == Integer.parseInt(f.toString())) {
                            listSelected.remove(i);
                            break;
                        }
                    }
                } else {
                    for (int i = 0; i < listEmployee.size(); i++) {
                        if (listEmployee.get(i).pn100 == Integer.parseInt(f.toString())) {
//                            if (list.get(i).getNv105() != null && list.get(i).getNv105() != "" && list.get(i).getNv105().contains("@")) {
                            listSelected.add(listEmployee.get(i));
                            break;
//                            }
                        }
                    }
                }
                List<N100> listgetrros = (List<N100>) listSelected;
                SessionProvider.setSessionMapValue("NUMBERPER", listgetrros.size());
                SessionProvider.setSessionMapValue("listSelectedEx", listSelected);
                SessionProvider.setSessionMapValue("listN100", listEmployee);

                //check All
            } else if (action1.equals("addAllCusp100")) {
                if (SessionProvider.getSessionMapValue("listSelected") != null) {
                    SessionProvider.removeSessionMapValue("listSelected");
                }
                if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                    SessionProvider.removeSessionMapValue("listSelectedEx");
                }
                if (SessionProvider.getSessionMapValue("listPersonalDSVN") != null) {
                    SessionProvider.removeSessionMapValue("listPersonalDSVN");
                }
                if (SessionProvider.getSessionMapValue("listPersonalDSDD") != null) {
                    SessionProvider.removeSessionMapValue("listPersonalDSDD");
                }
                Object va = getRequest().getParameter("boool");
                if ("true".equals(va.toString())) {
                    listSelected.clear();
                    for (int i = 0; i < listEmployee.size(); i++) {
//                        if (list.get(i).getNv105() != null && list.get(i).getNv105() != "" && list.get(i).getNv105().contains("@")) {
                        listSelected.add(listEmployee.get(i));
//                        }
                    }
                } else {
                    listSelected.clear();
                }
                List<N100> listgetrros = (List<N100>) listSelected;
                SessionProvider.setSessionMapValue("NUMBERPER", listgetrros.size());
                SessionProvider.setSessionMapValue("listSelectedEx", listSelected);
                SessionProvider.setSessionMapValue("listN100", listEmployee);
            } else if (action1.equals("addCusp100new")) {
                if (SessionProvider.getSessionMapValue("listSelected") != null) {
                    SessionProvider.removeSessionMapValue("listSelected");
                }
                if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                    SessionProvider.setSessionMapValue("listSelectedEx", null);
                }
                if (SessionProvider.getSessionMapValue("listN100") != null) {
                    SessionProvider.setSessionMapValue("listN100", null);
                }
                Object f = getRequest().getParameter("p100");
                Object s = getRequest().getParameter("valueB");
                if ("false".equals(s.toString())) {
                    for (int i = 0; i < listSelected.size(); i++) {
                        if (listSelected.get(i).pn100 == Integer.parseInt(f.toString())) {
                            listSelected.remove(i);
                            break;
                        }
                    }
                } else {
                    for (int i = 0; i < listEmployeeDB.size(); i++) {
                        if (listEmployeeDB.get(i).pn100 == Integer.parseInt(f.toString())) {
//                            if (list.get(i).getNv105() != null && list.get(i).getNv105() != "" && list.get(i).getNv105().contains("@")) {
                            listSelected.add(listEmployeeDB.get(i));
                            break;
//                            }
                        }
                    }
                }
                SessionProvider.setSessionMapValue("listSelectedEx", listSelected);
                SessionProvider.setSessionMapValue("listN100", listEmployeeDB);

                //check AlladdAllCusp100new
            } else if (action1.equals("addAllCusp100new")) {
                if (SessionProvider.getSessionMapValue("listSelected") != null) {
                    SessionProvider.removeSessionMapValue("listSelected");
                }
                if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                    SessionProvider.setSessionMapValue("listSelectedEx", null);
                }
                if (SessionProvider.getSessionMapValue("listN100") != null) {
                    SessionProvider.setSessionMapValue("listN100", null);
                }
                Object va = getRequest().getParameter("bool");
                if ("true".equals(va.toString())) {
                    listSelected.clear();
                    for (int i = 0; i < listEmployeeDB.size(); i++) {
//                        if (list.get(i).getNv105() != null && list.get(i).getNv105() != "" && list.get(i).getNv105().contains("@")) {
                        listSelected.add(listEmployeeDB.get(i));
//                        }
                    }
                } else {
                    listSelected.clear();
                }


                SessionProvider.setSessionMapValue("listSelectedEx", listSelected);
                SessionProvider.setSessionMapValue("listN100", listEmployeeDB);
            } else if (action1.equals("addCusp500new")) {
                if (SessionProvider.getSessionMapValue("listSelected") != null) {
                    SessionProvider.removeSessionMapValue("listSelected");
                }
                if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                    SessionProvider.setSessionMapValue("listSelectedEx", null);
                }
                if (SessionProvider.getSessionMapValue("listN100") != null) {
                    SessionProvider.setSessionMapValue("listN100", null);
                }
                Object f = getRequest().getParameter("p500");
                Object s = getRequest().getParameter("valueB");
                if ("false".equals(s.toString())) {
                    for (int i = 0; i < listSelectedN500.size(); i++) {
                        if (listSelectedN500.get(i).getPn500() == Integer.parseInt(f.toString())) {
                            listSelectedN500.remove(i);
                            break;
                        }
                    }
                } else {
                    for (int i = 0; i < listN500DB.size(); i++) {
                        if (listN500DB.get(i).getPn500() == Integer.parseInt(f.toString())) {
//                            if (list.get(i).getNv105() != null && list.get(i).getNv105() != "" && list.get(i).getNv105().contains("@")) {
                            listSelectedN500.add(listN500DB.get(i));
                            break;
//                            }
                        }
                    }
                }
                SessionProvider.setSessionMapValue("listSelectedEx", listSelectedN500);
                SessionProvider.setSessionMapValue("listN100", listN500DB);
            } else if (action1.equals("addallCusp500new")) {
                System.out.println("--------------" + listN500DB.size());
                if (SessionProvider.getSessionMapValue("listSelectedN500") != null) {
                    SessionProvider.removeSessionMapValue("listSelectedN500");
                }
                if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                    SessionProvider.setSessionMapValue("listSelectedEx", null);
                }
                if (SessionProvider.getSessionMapValue("listN100") != null) {
                    SessionProvider.setSessionMapValue("listN100", null);
                }
                Object va = getRequest().getParameter("bool");
                if ("true".equals(va.toString())) {
                    listSelectedN500.clear();
                    for (int i = 0; i < listN500DB.size(); i++) {
//                        if (list.get(i).getNv105() != null && list.get(i).getNv105() != "" && list.get(i).getNv105().contains("@")) {
                        listSelectedN500.add(listN500DB.get(i));
//                        }
                    }
                } else {
                    listSelectedN500.clear();
                }
                SessionProvider.setSessionMapValue("listSelectedEx", listSelectedN500);
                SessionProvider.setSessionMapValue("listN100", listN500DB);
            } else if (action1.equals("retore")) {
                Object objPN100Res = getRequest().getParameter("pn100");
                if (objPN100Res != null) {
                    pn100 = Integer.parseInt(objPN100Res.toString());
                }

            } else if (action1.equals("editEmpDel")) {
                Object Objpn100 = getRequest().getParameter("pn100");
                if (Objpn100 != null) {
                    this.pn100 = Integer.parseInt(Objpn100.toString());
                    listN100 = getListN100ById(pn100);
                }
                Object objectStep = getRequest().getParameter("step");
                if (objectStep != null) {
                    this.beginContructor = Integer.parseInt(objectStep.toString());
                }
            }






            // END SNS
            if (idSearch != null) {
                getLogin().setCharacter(idSearch.toString());
                if (idSearch.toString().equals("ALL")) {
                    getLogin().setCharacter(null);
                }
            }
            Object n450Object = getRequest().getParameter("action");
            if (n450Object != null) {

                if (n450Object.equals("n450from")) {
//                listn450i = getListN450Comb();
                }

            }
            Object objectN450 = getRequest().getParameter("n450");
            if (objectN450 != null) {
                this.fn450 = Integer.parseInt(objectN450.toString());
                getListN450CombSubmenu(fn450);
                SessionProvider.setSessionMapValue("idN450", fn450);

            }
            Object objPK400 = getRequest().getParameter("pk400");
            if (objPK400 != null) {
                fk400 = Integer.parseInt(objPK400.toString());
            }
            Object objectN850 = getRequest().getParameter("n850");
            if (objectN850 != null) {
                this.fn850 = Integer.parseInt(objectN850.toString());

                SessionProvider.setSessionMapValue("idN850", fn850);

            }
            Object grouppartoObject = getRequest().getParameter("action");
            if (grouppartoObject != null) {
                this.grouppart = Integer.parseInt(grouppartoObject.toString());
                SessionProvider.setSessionMapValue("grouppartN850", grouppart);

            }
            Object pn100ofN250 = getRequest().getParameter("pn100N250");
            if (pn100ofN250 != null) {
                this.pn100 = Integer.parseInt(pn100ofN250.toString());
                getListN100ByIdofN250_2(pn100);
            }



            Object action = getRequest().getParameter("action");
            Object objPN100 = getRequest().getParameter("pn100");
            if (objPN100 != null) {
                pn100 = Integer.parseInt(objPN100.toString());
            }
            if (action != null) {
                if (action.toString().equals("addEmp")) {
                    //   selectItemsN550 = getListSelectItems();
                    flag = false;
                } else if (action.toString().equals("editEmp")) {
                    this.pn100 = Integer.parseInt(ContextUtil.getRequestParameter("pn100A"));


                    flag = true;
                } else if (action.toString().equals("checkLogin")) {
                    Object objUser = getRequest().getParameter("username");
                    checkUserLogin(objUser.toString());
                } else if (action.equals("reloadGroup")) {
                    if (objPK400 != null) {
                        fk400 = Integer.parseInt(objPK400.toString());
                    }
                }
            }

        } catch (Exception e) {
            logger.debug("----------------" + e.getMessage());
        }

        Object actionn = getRequest().getParameter("actionn");
        if (actionn != null) {
            if (actionn.equals("reload")) {
                Object objUser = getRequest().getParameter("fn850");
                if (objUser != null) {
                    fn850 = Util.parseInt(objUser);
                    SessionProvider.setSessionMapValue("IDSENDSMSMAIL", fn850);
                }

            }
        }

        //paging
        int a;
        Object ppage = getRequest().getParameter("p");
        if (ppage != null) {
            try {
                a = Integer.parseInt(ppage.toString());
            } catch (Exception ex) {
                a = 1;
            }
            if (a == 1) {
                setCurrent(1);
                setOffset(0);
            } else {
                setCurrent(a);
                setOffset((a - 1) * Limit);
            }

        } else {
            SessionProvider.setSessionMapValue("typeSearchE", null);
            SessionProvider.setSessionMapValue("keySearchE", null);
            setCurrent(1);
            setOffset(0);
        }
    }

    // phu choi nhan vaien bi xoa
    public void retoresEmp() {
        try {
            CustomerStore k100Store = new CustomerStore();
            String vlue = null;
            int rs = k100Store.updateColumnN100(null, "N100", "NL145", null, "PN100", pn100, getLogin().getUserName());
            int rs1 = k100Store.updateColumnN100(null, "N100r", "NL145", vlue, "PN100", pn100, getLogin().getUserName());
        } catch (Exception e) {
        }
    }

    public void updateemployeetocustomer() {
        try {
            CustomerStore k100Store = new CustomerStore();
            int rs = k100Store.updateColumnN100(null, "N100", "FN600", String.valueOf(2), "PN100", pn100, getLogin().getUserName());
            int rs1 = k100Store.updateColumnN100(null, "N100r", "FN600", String.valueOf(2), "PN100", pn100, getLogin().getUserName());

        } catch (Exception e) {
        }
    }

    public void saveEmployee() {
        try {
            if (nv113 == null || nv113.isEmpty()) {
                nv113 = getLogin().getUserName();
            }
            if (getNv112() == null || getNv112().isEmpty()) {
                setNv112(getLogin().getUserName());
            }

            // String pn100Edit = ContextUtil.getRequestParameter("pn100Edit");
            String leavedate1 = ContextUtil.getRequestParameter("date");
            if (!leavedate1.equals("")) {
                dateBorn = Util.parseDate(leavedate1, "dd/MM/yyyy");
            } else {
                dateBorn = null;
            }

            if (this.getNv102() != null && this.nv103 != null && this.sexChangeItem != null && this.dateBorn != null) {

                System.out.println("---------EDIT---------" + this.pn100 + "," + FN600 + "," + 442 + "," + getLogin().getCompanyNo() + "," + this.getNv102() + "," + this.nv103 + "," + 1 + "," + 1 + ","
                        + this.nv106 + "," + this.sexChangeItem + "," + null + "," + this.status_family + "," + null + "," + null + "," + nv112 + ","
                        + nv113 + "," + 1 + "," + "N100" + "," + null + "," + 0 + "," + Util.toSQLDate(this.dateBorn) + "," + Util.UnUnicode(nv102) + "," + Util.UnUnicode(nv103) + "," + null + "," + null + "," + null + "," + null + "," + getNv127() + "," + Util.UnUnicode(this.getNv127()) + "," + null + "," + null + "," + getLogin().getModule() + "," + 0 + "," + 0 + "," + 0 + "," + getLogin().getUserName());
                int count = empInf.updateN100By(this.pn100, FN600, 442, getLogin().getCompanyNo(), this.getNv102(), this.nv103, 1, 1,
                        this.nv106, this.sexChangeItem, null, this.status_family, null, null, nv112,
                        nv113, 1, "N100", null, 0, Util.toSQLDate(this.dateBorn), Util.UnUnicode(nv102), Util.UnUnicode(nv103), null, null, null, null, getNv127(), Util.UnUnicode(this.getNv127()), null, null, getLogin().getModule(), 0, 0, 0, getLogin().getUserName());
                if (count > 0) {
                    pn100 = count;
                    int countLOGIN = employeeStore.updateColumnOneTable(null, "Q100", "QV101", nv106, "FN100", pn100, getLogin().getUserName());

                }
                if (SessionProvider.getSessionMapValue("PK100SS") != null || SessionProvider.getSessionMapValue("PKKKK") != null) {

                    int id = 0;
                    if (SessionProvider.getSessionMapValue("PKKKK") == null || SessionProvider.getSessionMapValue("PKKKK").equals("")) {
                        id = Integer.parseInt(SessionProvider.getSessionMapValue("PK100SS").toString());
                    } else {
                        id = Integer.parseInt(SessionProvider.getSessionMapValue("PKKKK").toString());
                    }
                    CustomerStore store = new CustomerStore();
                    int rs = store.updateColumnN100(null, "N100", "FK100", String.valueOf(id), "PN100", pn100, getLogin().getUserName());
                }
                setMessageform(getResourceString("success"));

                if (getRequest().getParameter("action") != null) {
                    if (getRequest().getParameter("action").equals("editEmployee")) {
                        // showGlobalReport(true, getResourceString("datasavesuccessful"));
                        sendRedirect("employeenew.jsp");
                    } else if (getRequest().getParameter("action").equals("editEmpDel")) {
                        // showGlobalReport(true, getResourceString("datasavesuccessful"));
                        sendRedirect("employeeDelete.jsp");
                    }
                }






            } else {
                setMessageform(getResourceString("error"));
            }
        } catch (Exception ex) {
            logger.debug("Check Information Employee" + ex.getMessage());
            showGlobalReport(true, getResourceString("datasuccessfail"));
            setMessageform("Cập nhật không thành công");
        }

        //sendRedirect("employee.jsp");

    }

    public int deleteEmployee(int id) {
        if (id != 0) {
            int rowefect = 0;
            rowefect = employeeStore.deleteEmployee(id, getLogin().getUserName());
            return rowefect;
        } else {
            return 0;
        }
    }
//Check user Login in System KAPI

    public void checkUserLogin(String username) {
        Q100Store q100Store = new Q100Store();

        beginContructor = q100Store.checkLoginExist(username);


    }

    public void reload() {

        try {
            System.out.println("------KHI CLICK VAO TIM KIEM CUA NHAN VIEN----" + typeSearch + "-------KEY---" + keySearch);
            SessionProvider.setSessionMapValue("submitSearch", "false");

            SessionProvider.setSessionMapValue("typeSearchE", typeSearch);
            SessionProvider.setSessionMapValue("keySearchE", keySearch);
            sendRedirectUrlTab("employeenew.jsp?action=functionSearch&keysearch=" + keySearch + "&typesearch=" + typeSearch);
        } catch (Exception e) {
        }
    }

    // onchange sinh nhat
    public void reloadStatusBr() {
        try {
            System.out.println("------NGÀY THÁNG---BBBBBBBB----" + startDT + endDT);

        } catch (Exception e) {
        }
    }

    public List<N100> NCURPKS_LISTOFTABN100BDAY() {
        try {

            listEmployee = employeeStore.NCURPKS_LISTOFTABN100BDAY(getLogin().getModule(), getLogin().getCompanyNo(), 2, Util.toSQLDate(startDT), Util.toSQLDate(endDT), getLogin().getUserName());

            return listEmployee;

        } catch (Exception e) {
            return null;
        }
    }

    public List<N100> getAllListN100DAC() {
        try {
            System.out.println("getAllListN100DAC ---------- " + getLogin().getModule() + ","
                    + getLogin().getCompanyNo() + ","
                    + 1 + ","
                    + Util.toSQLDate(startDT) + ","
                    + Util.toSQLDate(endDT) + ","
                    + getLogin().getUserName());
            listEmployeeDB = employeeStore.NCURPKS_LISTOFTABN100BDAY(getLogin().getModule(), getLogin().getCompanyNo(), 2, Util.toSQLDate(startDT), Util.toSQLDate(endDT), getLogin().getUserName());
            System.out.println("------HOW MUCH---AAAAAA----" + listEmployeeDB);
            if (listEmployeeDB.size() > 0) {
                SessionProvider.setSessionMapValue("ListSMSEmployeeDB", listEmployeeDB);
            }
            return listEmployeeDB;

        } catch (Exception e) {
            return null;
        }
    }

    public List<N100> getAllListN100DA() {
        try {
            System.out.println("ABC ---------- " + getLogin().getModule() + ","
                    + getLogin().getCompanyNo() + ","
                    + 1 + ","
                    + Util.toSQLDate(startDT) + ","
                    + Util.toSQLDate(endDT) + ","
                    + getLogin().getUserName());
            listEmployeeDB = employeeStore.NCURPKS_LISTOFTABN100BDAY(getLogin().getModule(), getLogin().getCompanyNo(), 1, Util.toSQLDate(startDT), Util.toSQLDate(endDT), getLogin().getUserName());
            if (listEmployeeDB.size() > 0) {
                SessionProvider.setSessionMapValue("ListSMSEmployeeDB", listEmployeeDB);
            }
            return listEmployeeDB;

        } catch (Exception e) {
            return null;
        }
    }

    public List<N100> getAllListN100() {
        int flags = 0;
        try {


            if (SessionProvider.getSessionMapValue("submitSearch") != null && SessionProvider.getSessionMapValue("submitSearch").toString().equals("true")) {
                setTypeSearch(0);
            }

            Object o = SessionProvider.getSessionMapValue("typeSearchE");
            if (o != null) {
                int type;
                try {
                    type = Integer.parseInt(o.toString());
                } catch (Exception e) {
                    type = 0;
                }
                setTypeSearch(type);

            }

            Object o2 = SessionProvider.getSessionMapValue("keySearchE");
            if (o2 != null) {

                setKeySearch(o2.toString());

            }

            if (getKeySearch() != null && getKeySearch().contains("Nhập từ khóa")) {
                setKeySearch(getLogin().getCharacter());
            } else if (getKeySearch() != null && getKeySearch().toLowerCase().contains("all")) {
                getLogin().setCharacter(null);
                setKeySearch("");
            }


//             if(fn450 == 9){
//                 return new ArrayList<N100>();
//             }
            System.out.println("--------AAAAAAAAAAAAAA-----------SEARCH--- : " + getTypeSearch());
            if (getTypeSearch() == 1 && getLogin().getCharacter() == null) {

                listEmployee = empInf.getListComN100Mobile(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                flags = 1;

            } else if (getTypeSearch() == 2 && getLogin().getCharacter() == null) {

                listEmployee = empInf.getListComN100Name(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                flags = 2;
            } else if (getTypeSearch() == 3 && getLogin().getCharacter() == null) {

                listEmployee = empInf.getListComN100Passport(getLogin().getModule(), getLogin().getCompanyNo(), 0, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                flags = 3;

            } else if (getTypeSearch() == 4 && getLogin().getCharacter() == null) {

                listEmployee = empInf.getListComN100Email(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                flags = 4;
            } else if (getTypeSearch() == 5 && getLogin().getCharacter() == null) {
                listEmployee = empInf.getListComN100NMSNV(getLogin().getModule(), fh200, fn450, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                flags = 5;
            } else if (getTypeSearch() == 0 && getLogin().getCharacter() == null) {
                if (SessionProvider.getSessionMapValue("IDSENDSMSMAIL") == null) {
                    fn850 = Util.parseInt(SessionProvider.getSessionMapValue("groupID"));
                } else {
                    fn850 = Util.parseInt(SessionProvider.getSessionMapValue("IDSENDSMSMAIL"));
                }
                
                if (pagename.equals("ALL")) {
                    System.out.println("-------NHAN VIEN--- KHI TIM KIEM-----" + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + this.getPn100() + "," + 0 + "," + 0 + "," + 0 + "," + keySearch + "," + Offset + "," + Limit + "," + 0 + "," + 0 + "," + getLogin().getUserName());
                    listEmployee = employeeStore.getAllListTabN100All(getLogin().getModule(), getLogin().getCompanyNo(), this.getPn100(), 0, 0, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                    flags = 0;
                } else {
                    System.out.println("-------NHAN VIEN----" + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + this.getPn100() + "," + fn450 + "," + fn850 + "," + fk400 + "," + keySearch + "," + Offset + "," + Limit + "," + 0 + "," + 0 + "," + getLogin().getUserName());
                    listEmployee = employeeStore.getAllListTabN100All(getLogin().getModule(), getLogin().getCompanyNo(), this.getPn100(), fn450, fn850, fk400, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                    flags = 0;
                }

            } else if (getLogin().getCharacter() != null) {

                listEmployee = employeeStore.lstSearchAlpha(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, Limit, 0, 0, getLogin().getUserName());
                flags = -1;
            }
            System.out.println("listEmployee size----" + listEmployee.size());
            if (listEmployee.size() > 0) {
                SessionProvider.setSessionMapValue("ListSMSEmployee1", listEmployee);
            }
         //   System.err.println
            if (Offset == 0) {
                if (listEmployee.size() > 0) {
                    N100 n100i = listEmployee.get(0);
                    if (n100i != null) {
//                        if(listEmployee.size()<=30){
//                             SessionProvider.setSessionMapValue("totalcurentE",listEmployee.size());
//                        }else{
                             SessionProvider.setSessionMapValue("totalcurentE", n100i.getRowss());
                     //   }
                       
                        //totalcurent = n100.getRowss();
                    } else {
                        SessionProvider.setSessionMapValue("totalcurentE", 0);
                        //totalcurent = 0;
                    }
                } else {
                    SessionProvider.setSessionMapValue("totalcurentE", 0);
                    //totalcurent = 0;
                }
            }



            //paging
            int t;
            Object obj = SessionProvider.getSessionMapValue("totalcurentE");
            if (obj != null) {
                try {
                    t = Integer.parseInt(obj.toString());
                } catch (Exception e) {
                    t = 0;
                }
                totalcurent = t;
            } else {
                totalcurent = 0;
            }

            setTotalrow(totalcurent);

            // duy sms
            List<N100> listN100 = new ArrayList<N100>();
            if (flags == 1) {

                listN100 = empInf.getListComN100Mobile(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());

            } else if (flags == 2) {

                listN100 = empInf.getListComN100Name(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());
            } else if (flags == 3) {

                listN100 = empInf.getListComN100Passport(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());

            } else if (flags == 4) {

                listN100 = empInf.getListComN100Email(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());
            } else if (flags == 5) {
                listN100 = empInf.getListComN100NMSNV(getLogin().getModule(), fh200, fn450, 0, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());
            } else if (flags == 0) {

                listN100 = employeeStore.getAllListTabN100All(getLogin().getModule(), getLogin().getCompanyNo(), this.getPn100(), fn450, 0, fk400, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());
            } else if (flags == -1) {

                listN100 = employeeStore.lstSearchAlpha(getLogin().getModule(), getLogin().getCompanyNo(), fn450, 0, keySearch, Offset, 10000, 0, 0, getLogin().getUserName());
            }
            SessionProvider.setSessionMapValue("ListSMSEmployee", listN100);

            return listEmployee;
        } catch (Exception e) {

            System.out.println("D:--error-------------getAllListN100-" + e.getMessage());
            listEmployee = new ArrayList<N100>();
            return null;
        }


    }

    public List<N100> getAllListN100Work() {
        try {
            listEmployee = empInf.getAllListTabN100(getLogin().getModule(), getLogin().getCompanyNo(), this.pn100, this.fn450, 0, getLogin().getCharacter(), getLogin().getUserName());
            return listEmployee;
        } catch (Exception e) {
            System.out.println("ERROR-------------N100-" + e.getMessage());
            return null;
        }
    }

    public void searchAlphaEmployee() {
        try {
            if (ContextUtil.getRequestParameter("idSearch") != null) {
                if (getLogin().getCharacter() != null || ContextUtil.getRequestParameter("idSearch").toString().equals(getLogin().getCharacter())) {
                    setTypeSearch(0);
                    setKeySearch(ContextUtil.getRequestParameter("idSearch").toString());

                    SessionProvider.setSessionMapValue("submitSearch", "true");
                } else {
                    setTypeSearch(0);
                    SessionProvider.setSessionMapValue("submitSearch", "false");
                }
            }
            setIdSearch(ContextUtil.getRequestParameter("idSearch"));

            if (getIdSearch() != null && getIdSearch().contains("ALL")) {
                setIdSearch(null);
                getLogin().setCharacter(getIdSearch());
            } else if (getIdSearch() == null) {
                getLogin().setCharacter(getId_search());
            } else {
                getLogin().setCharacter(getId_search());
            }
            System.out.println("getLogin().setCharacter" + getLogin().getCharacter());

        } catch (Exception ex) {
            setIdSearch("ALL");
        }

    }

    // danh sach nahn vien bi xoa
    public List<N100> getNCURPKS_LISTOFTABN100NDEL() {
        try {
            listN100 = employeeStore.getNCURPKS_LISTOFTABN100NDEL(getLogin().getModule(), getLogin().getCompanyNo(), 0, 0, 0, 0, keySearch, 0, 30, 0, 1, getLogin().getUserName());
            return listN100;
        } catch (Exception e) {
            return null;
        }
    }

    // hop dong
    public List<N100> getNCURPKS_LISTOFTABN100NHD(int pn100HD) {
        try {
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

            Date datecurent = new Date();
            nd353p = Util.toSQLDate(datecurent);

            String total = dateFormat.format(nd353p);
            System.out.println("---------------------NGAY--" + nd353p);
            nv952 = total.substring(0, 4);
            nv954 = total.substring(5, 7);
            nv955 = total.substring(8, 10);
            if (pn100HD == 0) {
                pn100HD = Util.parseInt(SessionProvider.getSessionMapValue("PN100HD"));
            }
            listN100 = employeeStore.getNCURPKS_LISTOFTABN100NHD(getLogin().getModule(), getLogin().getCompanyNo(), pn100HD, getLogin().getUserName());
            if (listN100 != null && listN100.size() > 0) {
                nd352c = listN100.get(0).getNd118();// ngay sinh nhat
                nd352p = listN100.get(0).getNd352();// ngay sinh nhat
                nv351p = listN100.get(0).getNv354();// noi cap
                nv112 = listN100.get(0).getNv112();// dia chi
                nv351c = listN100.get(0).getNv351();// So CMND
                nv106 = listN100.get(0).getQuoctich();// quoc tich
                nv107 = listN100.get(0).getNoisinh();// quoc tich
                nv110 = listN100.get(0).getNghenghiep();// quoc tich
                nv102 = listN100.get(0).getHoten();
                pn100 = listN100.get(0).getPn100();
                nv113 = listN100.get(0).getNv108();
            }
            return listN100;
        } catch (Exception e) {
            return null;
        }
    }

//    public List<EmployeeController> getListAlpha() throws SQLException, InstantiationException, IllegalAccessException {
//        char letter ;
//        EmployeeController letterBean;
//        cletter = new ArrayList<EmployeeController>();
//        for (letter = 'A'; letter <= 'Z'; letter++) {
//            letterBean = new EmployeeController();
//            letterBean.setAlpha(letter);
//            cletter.add(letterBean);
//        }
//        return cletter;
//    }
    public List<N100> getListN100ById(int id) {
        // System.out.println("--------------------2lay lai thong tin" + pn100 + "---" + pnPN100Detail);
        try {
            listN100 = employeeStore.getListN100ById(id, getLogin().getUserName());
            Iterator ic = listN100.iterator();
            while (ic.hasNext()) {
                n100 = (N100) ic.next();
                this.nv102 = n100.nv102;
                this.nv103 = n100.nv103;
                this.sexChangeItem = n100.nv107;
                this.dateBorn = n100.nd118;
                this.status_family = n100.nv109;
                this.nv110 = n100.nv110;
                this.pn100 = n100.pn100;
                this.FN600 = n100.getFn600();
                this.fk100 = n100.getFk100();
                this.nv106 = n100.nv106;
                this.nv127 = n100.getNv127();
            }
            return listN100;
        } catch (Exception ex) {
            return null;
        }
    }

    public void updateColumnN250() {
        try {
            List<SelectItem> listItem = comboboxUtil.getListCombN250();
            Iterator iterator = listItem.iterator();
            while (iterator.hasNext()) {
                SelectItem item = (SelectItem) iterator.next();
                if (fn250 == item.getValue()) {
                    this.nv251 = item.getLabel();

                }
            }

            int rowUpdate1 = employeeStore.updateColumnOneTable(null, "N100", "FN250", String.valueOf(fn250), "PN100", pn100, getLogin().getUserName());
            int rowUpdate3 = employeeStore.updateColumnOneTable(null, "N100", "NV251", nv251, "PN100", pn100, getLogin().getUserName());
            int rowUpdate2 = employeeStore.updateColumnOneTable(null, "N100r", "FN250", String.valueOf(fn250), "PN100", pn100, getLogin().getUserName());
            int rowUpdate4 = employeeStore.updateColumnOneTable(null, "N100r", "NV251", nv251, "PN100", pn100, getLogin().getUserName());
            if (rowUpdate1 > 0 && rowUpdate2 > 0 && rowUpdate3 > 0 && rowUpdate4 > 0) {
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {

                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            sendRedirect("employeenew.jsp");
        } catch (Exception e) {
        }
    }

    public List<N100> getListAllN100ofN250() {

        try {
            List<N100> list = employeeStore.getAllListTabN100(getLogin().getModule(), getLogin().getCompanyNo(), 0, this.fn450, this.fn850, getLogin().getCharacter(), getLogin().getUserName());
            return list;
        } catch (Exception ex) {
            System.out.println(ex);
            return null;
        }

    }

    public void getListN100ByIdofN250_2(int id) {
        try {
            List<N100> listN100E = employeeStore.getAllListTabN100(getLogin().getModule(), getLogin().getCompanyNo(), id, this.fn450, this.fn850, getLogin().getCharacter(), getLogin().getUserName());
            if (listN100E.size() > 0) {
                for (int i = 0; i < listN100E.size(); i++) {
                    if (listN100E.get(i).getPn100() == id) {
                        this.fn250 = listN100E.get(i).getFn250();

                        break;
                    }
                }
            }
        } catch (Exception ex) {
            System.out.println("Error when getDetailEditN850. ERROR CODE: " + ex.getMessage());
        }


    }

    public List<N450> getListN450Comb() {
        try {
            N450Store n450Store = new N450Store();
            List<N450> listCombN450 = getLogin().getListN450();
            System.out.println("---------------" + listCombN450.get(0).getNv451());
            return listCombN450;
        } catch (Exception e) {
            return null;
        }

    }

    public List<N850> getListN850() {
        try {
            int idNN450 = Util.parseInt(SessionProvider.getSessionMapValue("idN450"));
            N850Store n850Store = new N850Store();
            List<N850> listComb850 = n850Store.findAllN850ForCombo(getLogin().getModule(), 99, idNN450, getLogin().getUserName());
            return listComb850;
        } catch (Exception e) {
            return null;
        }

    }

    public void getListN450CombSubmenu(int id) {
        try {
            List<N450> listN850Edit = getListN450Comb();
            if (listN850Edit != null) {
                for (int i = 0; i < listN850Edit.size(); i++) {
                    if (listN850Edit.get(i).getPn450() == id) {
                        this.menusub = listN850Edit.get(i).getLabel();

                        break;
                    }
                }
            }
        } catch (Exception ex) {
            System.out.println("Error when getDetailEditN850. ERROR CODE: " + ex.getMessage());
        }
    }

    // Ham edit thogn tin ca nhan cho nhan vien
    public List<L200> getListAllL200ById(int id) {
        try {
            // int pn1000 = EmployeeController.getPnPN100Detail();
            L200Store l200Store = new L200Store();
            System.out.println("--list---" + id + "," + 0 + "," + getLogin().getUserName());
            List<L200> listL200 = l200Store.findl200(getLogin().getCompanyNo(), id, getLogin().getUserName());
            if (listL200.size() > 0) {
                Iterator icIterator = listL200.iterator();
                while (icIterator.hasNext()) {
                    L200 l200 = (L200) icIterator.next();
                    this.pn100 = l200.getFn100();
//                    this.ln203 = l200.getLn203();
//                    this.ln204 = l200.getLn204();
                    this.setLn205(l200.getLn205());
                    this.setLn206(l200.getLn206());
                    this.setLn207(l200.getLn207());
                    this.setLn209(l200.getLn209());
                    this.setLn210(l200.getLn210());
                    this.setLn213(l200.getLn213());
                    this.setLv208(l200.getLv208());
                    this.setLv211(l200.getLv211());
                    this.setLv212(l200.getLv212());
                    this.setLd202(l200.getLd202());
                    this.setLd201(l200.getLd201());
                    this.setLv224(l200.getLv224());
                    this.setLv214(l200.getLv214());

                    double ln213db = Util.convertStringToDouble(String.valueOf(l200.getLn213()));
                    setLn213st(Util.numberformater(ln213db, "##,###,###"));
                    System.out.println("-------ln203---" + getLn213st());

                    double ln203db = Util.convertStringToDouble(String.valueOf(l200.getLn203()));
                    setLn203st(Util.numberformater(ln203db, "##,###,###"));
                    System.out.println("-------ln203---" + getLn203st());

                    double ln204db = Util.convertStringToDouble(String.valueOf(l200.getLn204()));
                    setLn204st(Util.numberformater(ln204db, "##,###,###"));

                    double ln205db = Util.convertStringToDouble(String.valueOf(l200.getLn205()));
                    setLn205st(Util.numberformater(ln205db, "##,###,###"));

                    double ln207db = Util.convertStringToDouble(String.valueOf(l200.getLn207()));
                    setLn207st(Util.numberformater(ln207db, "##,###,###"));
                }

            } else {
                // this.pn100 = pn1000;
            }
            return listL200;
        } catch (Exception ex) {
            System.out.println(ex);
            return null;
        }
    }

    // Ham giay to tuy than cho nhan vien
    public void getDetailFromN350(int id) {
        N350Store n350Store = new N350Store();
        List<N350> lst = n350Store.findN350All(7, 99, 0, id, 0, getLogin().getUserName());
        if (lst.size() > 0) {
            Iterator ic = lst.iterator();
            while (ic.hasNext()) {
                N350 n350 = (N350) ic.next();
                // this.pn350 = n350.getPN350();
                this.setNn355(n350.getNN355());
                //cmnd
                if (getNn355() == 1) {
                    setNn355c(true);
                    this.setNv354c(n350.getNv354());
                    this.setNv351c(n350.getNv351());
                    this.nd352c = n350.getNd352();
                    // this.nd353c = n350.getNd353();
                    this.pn350c = n350.getPN350();
                }//passport
                if (getNn355() == 2) {
                    setNn355p(true);
                    this.setNv354p(n350.getNv354());
                    this.setNv351p(n350.getNv351());
                    this.setNd352p(n350.getNd352());
                    this.nd353p = n350.getNd353();
                    this.pn350p = n350.getPN350();
                }
            }
        }
    }

    public void updateL200() throws ParseException {
        L200Store l200Store = new L200Store();
        System.out.println("---pn100-ds--" + pn100);
        String date = ContextUtil.getRequestParameter("leavedate1");
        if (!date.equals("")) {
            setLd201(Util.parseDate(date, "dd/MM/yyyy"));
        } else {
            setLd201(null);
        }

        date = ContextUtil.getRequestParameter("leavedate2");
        if (!date.equals("")) {
            setLd202(Util.parseDate(date, "dd/MM/yyyy"));
        } else {
            setLd202(null);
        }
        if (!"".equals(ln203st)) {
            ln203 = Integer.parseInt(ln203st.replaceAll(",", "").trim());
        }
        if (!"".equals(ln204st)) {
            ln204 = Integer.parseInt(ln204st.replaceAll(",", "").trim());
        }
        if (!"".equals(ln205st)) {
            ln205 = Integer.parseInt(ln205st.replaceAll(",", "").trim());
        }
        if (!"".equals(ln213st)) {
            ln213 = Integer.parseInt(ln213st.replaceAll(",", "").trim());
        }
        if (!"".equals(ln207st)) {
            ln207 = Integer.parseInt(ln207st.replaceAll(",", "").trim());
        }

        System.out.println("---" + this.getPn100() + "," + Util.toSQLDate(this.getLd201()) + "," + Util.toSQLDate(this.getLd202()) + "," + this.getLn203() + "," + this.getLn204() + "," + this.getLn205() + "," + this.getLn206() + "," + this.getLn207() + "," + this.getLv208() + "," + this.getLn209() + "," + this.getLn210() + "," + this.getLv211() + "," + this.getLv212() + "," + this.getLn213() + "," + this.getLv224() + "," + getLogin().getUserName());

        int count = l200Store.updateL200By(this.pn100, Util.toSQLDate(this.getLd201()), Util.toSQLDate(this.getLd202()), this.getLn203(), this.getLn204(), this.getLn205(), this.getLn206(), this.getLn207(), this.getLv208(), this.getLn209(), this.getLn210(), this.getLv211(), this.getLv212(), this.getLn213(), this.getLv214(), null, null, this.getLv224(), getLogin().getUserName());
        if (count > 0) {
            setMessageform(getResourceString("datasavesuccessful"));
            showGlobalReport(true, getResourceString("datasavesuccessful"));
        } else {
            setMessageform("Cập nhật không thành công");
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }



    }

    //update 
    public void saveN950() {
        try {
            ContactStore store = new ContactStore();
            int roweffect = 0;
            //  System.out.println("-----id----------" + pn100);
            roweffect = store.updateN950By(this.pn100, 1, "N100", this.nv952,
                    null, this.nv954, this.nv955, null, this.nv957, 1, this.nv958, null, this.nv960, this.nv961,
                    this.nv962, null, null, null, null, this.nv967, this.nv968, this.nv969, null, null, 1, nv973, nv974, nv975, getLogin().getUserName());
            if (roweffect > 0) {
                setMessageform(getResourceString("datasavesuccessful"));
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                setMessageform("Cập nhật không thành công");
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
        } catch (Exception ex) {
            System.out.println("00000>>>>" + ex.getMessage());
            setMessageform("Cập nhật không thành công");
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }

    }

    // update N350
    public void saveN350() throws ParseException {
        N350Store n350Store = new N350Store();
        // System.out.println("----fn100-------------" + this.pn100);
        try {
            int count1 = 0;
            int count2 = 0;

            if (nn355c == true) {
                // System.out.println("----fn100-------cccc------" + this.pn350c);
                String dateStart = ContextUtil.getRequestParameter("dateStart");
                if (!dateStart.equals("")) {
                    nd352c = Util.parseDate(dateStart, "dd/MM/yyyy");
                } else {
                    nd352c = null;
                }

                count1 = n350Store.updateN350By(this.pn350c, pn100, this.nv351c, Util.toSQLDate(this.nd352c), Util.toSQLDate(this.nd353c), this.nv354c, 1, 7, 99, getLogin().getUserName());
                //  System.out.println("----fn100-------cccc------" + count1);
            }
            if (nn355p == true) {
                //  System.out.println("----fn100-------pppppp------" + this.pn350p);
                String dateStart1 = ContextUtil.getRequestParameter("dateStart1");
                if (!dateStart1.equals("")) {
                    nd352p = Util.parseDate(dateStart1, "dd/MM/yyyy");
                } else {
                    nd352p = null;
                }
                String dateEnd1 = ContextUtil.getRequestParameter("dateEnd1");
                if (!dateEnd1.equals("")) {
                    nd353p = Util.parseDate(dateEnd1, "dd/MM/yyyy");
                } else {
                    nd353p = null;
                }



                count2 = n350Store.updateN350By(this.pn350p, pn100, this.nv351p, Util.toSQLDate(this.nd352p), Util.toSQLDate(this.nd353p), this.nv354p, 2, 7, 99, getLogin().getUserName());

            }

            if ((count1 >= 0 && nn355p == false) || (count2 >= 0 && nn355c == false) || (count1 > 0 && count2 > 0)) {
                setMessageform(getResourceString("datasavesuccessful"));
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {
                setMessageform("Cập nhật không thành công");
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }



        } catch (Exception ex) {
        }
    }
//

    public void updateT025() {
        T025Store t025Store = new T025Store();
        // System.out.println("----fn100-------------" + this.pn100);

        int count = t025Store.updateT025(1, pn100, "N100", TV027, TV028, TV029, TV030, 0, 0, 0, getLogin().getModule(), getLogin().getCompanyNo(), getLogin().getUserName());
        //  System.out.println("----Message-------------------------------" + count);
        if (count > 0) {
            setMessageform(getResourceString("datasavesuccessful"));
            showGlobalReport(true, getResourceString("datasavesuccessful"));
        } else {
            setMessageform("Cập nhật không thành công");
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }


    }
// tung end
//them filter theo n450 va nhom khac

    public void changeGroupN450(ActionEvent ac) {
        System.out.println("changeGroupN450---:" + fn450);
//        SessionProvider.setSessionMapValue("groupN450", fn450);
    }

    public void changeGroupN850(ActionEvent ac) {
        System.out.println("changeGroupN850---:" + fn850);
//        SessionProvider.setSessionMapValue("groupN450", fn450);
    }

    public void changeGroupOther(ActionEvent ac) {
        System.out.println("changeGroupOther---: " + fk400);
//        SessionProvider.setSessionMapValue("groupOther", fk400);       

    }
    // Start Get Setter-------------------------------------------------------
    //Chia danh sach phog ban cho nhan vien

    public List<SelectItem> getListCombN850() {
        return comboboxUtil.getSelectedN850Comb();
    }

    /**
     * @return the empInf
     */
    public EmployeeInf getEmpInf() {
        return empInf;
    }

    /**
     * @param empInf the empInf to set
     */
    public void setEmpInf(EmployeeInf empInf) {
        this.empInf = empInf;
    }

    /**
     * @return the q100Inf
     */
    public Q100Inf getQ100Inf() {
        return q100Inf;
    }

    /**
     * @param q100Inf the q100Inf to set
     */
    public void setQ100Inf(Q100Inf q100Inf) {
        this.q100Inf = q100Inf;
    }

    /**
     * @return the dateBorn
     */
    public Date getDateBorn() {
        return dateBorn;
    }

    /**
     * @param dateBorn the dateBorn to set
     */
    public void setDateBorn(Date dateBorn) {
        this.dateBorn = dateBorn;
    }

    /**
     * @return the idEmp
     */
//    public int getIdEmp() {
//        return idEmp;
//    }
//
//    /**
//     * @param aIdEmp the idEmp to set
//     */
//    public void setIdEmp(int aIdEmp) {
//        idEmp = aIdEmp;
//    }
    // End Get Setter----------------------------------------------------------
    /**
     * @return the sexChangeItem
     */
    public String getSexChangeItem() {
        return sexChangeItem;
    }

    /**
     * @param sexChangeItem the sexChangeItem to set
     */
    public void setSexChangeItem(String sexChangeItem) {
        this.sexChangeItem = sexChangeItem;
    }

    /**
     * @return the industry
     */
    public String getIndustry() {
        return industry;
    }

    /**
     * @param industry the industry to set
     */
    public void setIndustry(String industry) {
        this.industry = industry;
    }

    /**
     * @return the status_family
     */
    public String getStatus_family() {
        return status_family;
    }

    /**
     * @param status_family the status_family to set
     */
    public void setStatus_family(String status_family) {
        this.status_family = status_family;
    }

    /**
     * @return the fullName
     */
    public String getFullName() {
        return fullName;
    }

    /**
     * @param fullName the fullName to set
     */
    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    /**
     * @return the nv102_nv103
     */
    public String getNv102_nv103() {
        return nv102_nv103;
    }

    /**
     * @param nv102_nv103 the nv102_nv103 to set
     */
    public void setNv102_nv103(String nv102_nv103) {
        this.nv102_nv103 = nv102_nv103;
    }

    /**
     * @return the nv107
     */
    public String getNv107() {
        return nv107;
    }

    /**
     * @param nv107 the nv107 to set
     */
    public void setNv107(String nv107) {
        this.nv107 = nv107;
    }

    /**
     * @return the listEmployee
     */
    public List getListEmployee() {
        return listEmployee;
    }

    /**
     * @param listEmployee the listEmployee to set
     */
    public void setListEmployee(List listEmployee) {
        this.listEmployee = listEmployee;
    }

    /**
     * @return the pn100
     */
    public int getPn100() {

        return pn100;
    }

    /**
     * @param pn100 the pn100 to set
     */
    public void setPn100(int pn100) {
        this.pn100 = pn100;
    }

    /**
     * @return the alpha
     */
    public char getAlpha() {
        return alpha;
    }

    /**
     * @param alpha the alpha to set
     */
    public void setAlpha(char alpha) {
        this.alpha = alpha;
    }

    /**
     * @return the number
     */
    public String getNumber() {
        return number;
    }

    /**
     * @param number the number to set
     */
    public void setNumber(String number) {
        this.number = number;
    }

    /**
     * @return the n100
     */
    public N100 getN100() {
        return n100;
    }

    /**
     * @param n100 the n100 to set
     */
    public void setN100(N100 n100) {
        this.n100 = n100;
    }

    /**
     * @return the messageform
     */
    public String getMessageform() {
        return messageform;
    }

    /**
     * @param messageform the messageform to set
     */
    public void setMessageform(String messageform) {
        this.messageform = messageform;
    }

    /**
     * @return the demo
     */
    /**
     * @return the pnPN100Detail
     */
//    public static int getPnPN100Detail() {
//        return pnPN100Detail;
//    }
//
//    /**
//     * @param aPnPN100Detail the pnPN100Detail to set
//     */
//    public static void setPnPN100Detail(int aPnPN100Detail) {
//        pnPN100Detail = aPnPN100Detail;
//    }
    /**
     * @return the avata
     */
    public String getAvata() {
        M650Store attachmentStore = new M650Store();
        List<M650> list = new ArrayList<M650>();
        System.out.println("size of list....." + loginSession.getLogin().getModule());
        try {
            list = attachmentStore.findM650(loginSession.getLogin().getModule(),
                    loginSession.getLogin().getCompanyNo(),
                    0,
                    null,
                    0,
                    0,
                    0,//pnMN654
                    null,
                    "N100",
                    0,
                    0, //pnMN658
                    null, null, 0, 10000, 0, 0,
                    loginSession.getLogin().getUserName());
            System.out.println("size of list......." + list.size());
            if (list.size() > 0) {
                avata = ResourcesProvider.getDownloadFolder(list.get(0).getMv653());
                pm650 = list.get(0).getPm650();
            } else {
                avata = "../images/user-img.jpg";
            }
        } catch (Exception e) {
            System.out.println("error database" + e.getMessage());
        }
        return avata;
    }

    /**
     * @param avata the avata to set
     */
    public void setAvata(String avata) {
        this.avata = avata;
    }

    /**
     * @return the pm650
     */
    public int getPm650() {
        return pm650;
    }

    /**
     * @param pm650 the pm650 to set
     */
    public void setPm650(int pm650) {
        this.pm650 = pm650;
    }

    /**
     * @return the pq100
     */
    public int getPq100() {

        if (pq100 == 0) {
            // pq100 = pnPN100Detail;
        }
        return pq100;
    }

    /**
     * @param pq100 the pq100 to set
     */
    public void setPq100(int pq100) {
        this.pq100 = pq100;
    }

    /**
     * @return the nv110
     */
    public String getNv110() {
        return nv110;
    }

    /**
     * @param nv110 the nv110 to set
     */
    public void setNv110(String nv110) {
        this.nv110 = nv110;
    }

    /**
     * @return the nv102
     */
    public String getNv102() {
        return nv102;
    }

    /**
     * @param nv102 the nv102 to set
     */
    public void setNv102(String nv102) {
        this.nv102 = nv102;
    }

    /**
     * @return the nv103
     */
    public String getNv103() {
        return nv103;
    }

    /**
     * @param nv103 the nv103 to set
     */
    public void setNv103(String nv103) {
        this.nv103 = nv103;
    }

    /**
     * @return the flag
     */
    public boolean isFlag() {
        return flag;
    }

    /**
     * @param flag the flag to set
     */
    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    /**
     * @return the FN600
     */
    public int getFN600() {
        return FN600;
    }

    /**
     * @param FN600 the FN600 to set
     */
    public void setFN600(int FN600) {
        this.FN600 = FN600;
    }

    /**
     * @return the fk100
     */
    public int getFk100() {
        return fk100;
    }

    /**
     * @param fk100 the fk100 to set
     */
    public void setFk100(int fk100) {
        this.fk100 = fk100;
    }

    /**
     * @return the nv113
     */
    public String getNv113() {
        return nv113;
    }

    /**
     * @param nv113 the nv113 to set
     */
    public void setNv113(String nv113) {
        this.nv113 = nv113;
    }

    /**
     * @return the nv962
     */
    public String getNv962() {
        return nv962;
    }

    /**
     * @param nv962 the nv962 to set
     */
    public void setNv962(String nv962) {
        this.nv962 = nv962;
    }

    /**
     * @return the nv958
     */
    public String getNv958() {
        return nv958;
    }

    /**
     * @param nv958 the nv958 to set
     */
    public void setNv958(String nv958) {
        this.nv958 = nv958;
    }

    /**
     * @return the nv967
     */
    public String getNv967() {
        return nv967;
    }

    /**
     * @param nv967 the nv967 to set
     */
    public void setNv967(String nv967) {
        this.nv967 = nv967;
    }

    /**
     * @return the nv106
     */
    public String getNv106() {
        return nv106;
    }

    /**
     * @param nv106 the nv106 to set
     */
    public void setNv106(String nv106) {
        this.nv106 = nv106;
    }

    /**
     * @return the active_nv106
     */
    public String getActive_nv106() {
        return active_nv106;
    }

    /**
     * @param active_nv106 the active_nv106 to set
     */
    public void setActive_nv106(String active_nv106) {
        this.active_nv106 = active_nv106;
    }

    /**
     * @return the idSearch
     */
    public String getIdSearch() {
        idSearch = getLogin().getCharacter();
        return idSearch;
    }

    /**
     * @param idSearch the idSearch to set
     */
    public void setIdSearch(String idSearch) {
        this.idSearch = idSearch;
    }

    /**
     * @return the beginContructor
     */
    public int getBeginContructor() {
        return beginContructor;
    }

    /**
     * @param beginContructor the beginContructor to set
     */
    public void setBeginContructor(int beginContructor) {
        this.beginContructor = beginContructor;
    }

    /**
     * @return the result
     */
    public boolean isResult() {
        return result;
    }

    /**
     * @param result the result to set
     */
    public void setResult(boolean result) {
        this.result = result;
    }

    /**
     * @return the flagCheckLogin
     */
    public boolean isFlagCheckLogin() {
        return flagCheckLogin;
    }

    /**
     * @param flagCheckLogin the flagCheckLogin to set
     */
    public void setFlagCheckLogin(boolean flagCheckLogin) {
        this.flagCheckLogin = flagCheckLogin;
    }

    /**
     * @return the keySearch
     */
    public String getKeySearch() {
        return keySearch;
    }

    /**
     * @param keySearch the keySearch to set
     */
    public void setKeySearch(String keySearch) {
        this.keySearch = keySearch;
    }

    /**
     * @return the typeSearch
     */
    public int getTypeSearch() {
        return typeSearch;
    }

    /**
     * @param typeSearch the typeSearch to set
     */
    public void setTypeSearch(int typeSearch) {
        this.typeSearch = typeSearch;
    }

    /**
     * @return the id_search
     */
    public String getId_search() {
        return id_search;
    }

    /**
     * @param id_search the id_search to set
     */
    public void setId_search(String id_search) {
        this.id_search = id_search;
    }

    /**
     * @return the democheck
     */
    public boolean isDemocheck() {
        return democheck;
    }

    /**
     * @param democheck the democheck to set
     */
    public void setDemocheck(boolean democheck) {
        this.democheck = democheck;
    }

    /**
     * @return the fn450
     */
    public int getFn450() {
        fn450 = Util.parseInt(SessionProvider.getSessionMapValue("idN450"));
        return fn450;
    }

    /**
     * @param fn450 the fn450 to set
     */
    public void setFn450(int fn450) {
        this.fn450 = fn450;
    }

    /**
     * @return the fn850
     */
    public int getFn850() {

        return fn850;
    }

    /**
     * @param fn850 the fn850 to set
     */
    public void setFn850(int fn850) {
        this.fn850 = fn850;
    }

    /**
     * @return the combN250
     */
    public List<SelectItem> getCombN250() {
        combN250 = comboboxUtil.getListCombN250();
        return combN250;
    }

    /**
     * @param combN250 the combN250 to set
     */
    public void setCombN250(List<SelectItem> combN250) {
        this.combN250 = combN250;
    }

    /**
     * @return the fn250
     */
    public int getFn250() {
        return fn250;
    }

    /**
     * @param fn250 the fn250 to set
     */
    public void setFn250(int fn250) {
        this.fn250 = fn250;
    }

    /**
     * @return the nv251
     */
    public String getNv251() {
        return nv251;
    }

    /**
     * @param nv251 the nv251 to set
     */
    public void setNv251(String nv251) {
        this.nv251 = nv251;
    }

    /**
     * @return the listn450i
     */
    public List<N450> getListn450i() {
        return listn450i;
    }

    /**
     * @param listn450i the listn450i to set
     */
    public void setListn450i(List<N450> listn450i) {
        this.listn450i = listn450i;
    }

    /**
     * @return the grouppart
     */
    public int getGrouppart() {
        grouppart = Util.parseInt(SessionProvider.getSessionMapValue("grouppartN850"));
        return grouppart;
    }

    /**
     * @param grouppart the grouppart to set
     */
    public void setGrouppart(int grouppart) {
        this.grouppart = grouppart;
    }

    /**
     * @return the nv961
     */
    public String getNv961() {
        return nv961;
    }

    /**
     * @param nv961 the nv961 to set
     */
    public void setNv961(String nv961) {
        this.nv961 = nv961;
    }

    /**
     * @return the nv968
     */
    public String getNv968() {
        return nv968;
    }

    /**
     * @param nv968 the nv968 to set
     */
    public void setNv968(String nv968) {
        this.nv968 = nv968;
    }

    /**
     * @return the nv969
     */
    public String getNv969() {
        return nv969;
    }

    /**
     * @param nv969 the nv969 to set
     */
    public void setNv969(String nv969) {
        this.nv969 = nv969;
    }

    /**
     * @return the nv952
     */
    public String getNv952() {
        return nv952;
    }

    /**
     * @param nv952 the nv952 to set
     */
    public void setNv952(String nv952) {
        this.nv952 = nv952;
    }

    /**
     * @return the nv955
     */
    public String getNv955() {
        return nv955;
    }

    /**
     * @param nv955 the nv955 to set
     */
    public void setNv955(String nv955) {
        this.nv955 = nv955;
    }

    /**
     * @return the nv957
     */
    public String getNv957() {
        return nv957;
    }

    /**
     * @param nv957 the nv957 to set
     */
    public void setNv957(String nv957) {
        this.nv957 = nv957;
    }

    /**
     * @return the nv960
     */
    public String getNv960() {
        return nv960;
    }

    /**
     * @param nv960 the nv960 to set
     */
    public void setNv960(String nv960) {
        this.nv960 = nv960;
    }

    /**
     * @return the nv954
     */
    public String getNv954() {
        return nv954;
    }

    /**
     * @param nv954 the nv954 to set
     */
    public void setNv954(String nv954) {
        this.nv954 = nv954;
    }

    /**
     * @return the ld201
     */
    public Date getLd201() {
        return ld201;
    }

    /**
     * @param ld201 the ld201 to set
     */
    public void setLd201(Date ld201) {
        this.ld201 = ld201;
    }

    /**
     * @return the ld202
     */
    public Date getLd202() {
        return ld202;
    }

    /**
     * @param ld202 the ld202 to set
     */
    public void setLd202(Date ld202) {
        this.ld202 = ld202;
    }

    /**
     * @return the ln203
     */
    public int getLn203() {
        return ln203;
    }

    /**
     * @param ln203 the ln203 to set
     */
    public void setLn203(int ln203) {
        this.ln203 = ln203;
    }

    /**
     * @return the ln204
     */
    public int getLn204() {
        return ln204;
    }

    /**
     * @param ln204 the ln204 to set
     */
    public void setLn204(int ln204) {
        this.ln204 = ln204;
    }

    /**
     * @return the ln205
     */
    public int getLn205() {
        return ln205;
    }

    /**
     * @param ln205 the ln205 to set
     */
    public void setLn205(int ln205) {
        this.ln205 = ln205;
    }

    /**
     * @return the ln206
     */
    public int getLn206() {
        return ln206;
    }

    /**
     * @param ln206 the ln206 to set
     */
    public void setLn206(int ln206) {
        this.ln206 = ln206;
    }

    /**
     * @return the ln207
     */
    public int getLn207() {
        return ln207;
    }

    /**
     * @param ln207 the ln207 to set
     */
    public void setLn207(int ln207) {
        this.ln207 = ln207;
    }

    /**
     * @return the lv208
     */
    public String getLv208() {
        return lv208;
    }

    /**
     * @param lv208 the lv208 to set
     */
    public void setLv208(String lv208) {
        this.lv208 = lv208;
    }

    /**
     * @return the ln209
     */
    public int getLn209() {
        return ln209;
    }

    /**
     * @param ln209 the ln209 to set
     */
    public void setLn209(int ln209) {
        this.ln209 = ln209;
    }

    /**
     * @return the ln210
     */
    public int getLn210() {
        return ln210;
    }

    /**
     * @param ln210 the ln210 to set
     */
    public void setLn210(int ln210) {
        this.ln210 = ln210;
    }

    /**
     * @return the lv211
     */
    public String getLv211() {
        return lv211;
    }

    /**
     * @param lv211 the lv211 to set
     */
    public void setLv211(String lv211) {
        this.lv211 = lv211;
    }

    /**
     * @return the lv212
     */
    public String getLv212() {
        return lv212;
    }

    /**
     * @param lv212 the lv212 to set
     */
    public void setLv212(String lv212) {
        this.lv212 = lv212;
    }

    /**
     * @return the ln213
     */
    public int getLn213() {
        return ln213;
    }

    /**
     * @param ln213 the ln213 to set
     */
    public void setLn213(int ln213) {
        this.ln213 = ln213;
    }

    /**
     * @return the lv214
     */
    public String getLv214() {
        return lv214;
    }

    /**
     * @param lv214 the lv214 to set
     */
    public void setLv214(String lv214) {
        this.lv214 = lv214;
    }

    /**
     * @return the lv224
     */
    public String getLv224() {
        return lv224;
    }

    /**
     * @param lv224 the lv224 to set
     */
    public void setLv224(String lv224) {
        this.lv224 = lv224;
    }

    /**
     * @return the ln203st
     */
    public String getLn203st() {
        return ln203st;
    }

    /**
     * @param ln203st the ln203st to set
     */
    public void setLn203st(String ln203st) {
        this.ln203st = ln203st;
    }

    /**
     * @return the ln204st
     */
    public String getLn204st() {
        return ln204st;
    }

    /**
     * @param ln204st the ln204st to set
     */
    public void setLn204st(String ln204st) {
        this.ln204st = ln204st;
    }

    /**
     * @return the ln205st
     */
    public String getLn205st() {
        return ln205st;
    }

    /**
     * @param ln205st the ln205st to set
     */
    public void setLn205st(String ln205st) {
        this.ln205st = ln205st;
    }

    /**
     * @return the ln213st
     */
    public String getLn213st() {
        return ln213st;
    }

    /**
     * @param ln213st the ln213st to set
     */
    public void setLn213st(String ln213st) {
        this.ln213st = ln213st;
    }

    /**
     * @return the ln207st
     */
    public String getLn207st() {
        return ln207st;
    }

    /**
     * @param ln207st the ln207st to set
     */
    public void setLn207st(String ln207st) {
        this.ln207st = ln207st;
    }

    /**
     * @return the nv354p
     */
    public String getNv354p() {
        return nv354p;
    }

    /**
     * @param nv354p the nv354p to set
     */
    public void setNv354p(String nv354p) {
        this.nv354p = nv354p;
    }

    /**
     * @return the nv354c
     */
    public String getNv354c() {
        return nv354c;
    }

    /**
     * @param nv354c the nv354c to set
     */
    public void setNv354c(String nv354c) {
        this.nv354c = nv354c;
    }

    /**
     * @return the nv351p
     */
    public String getNv351p() {
        return nv351p;
    }

    /**
     * @param nv351p the nv351p to set
     */
    public void setNv351p(String nv351p) {
        this.nv351p = nv351p;
    }

    /**
     * @return the nv351c
     */
    public String getNv351c() {
        return nv351c;
    }

    /**
     * @param nv351c the nv351c to set
     */
    public void setNv351c(String nv351c) {
        this.nv351c = nv351c;
    }

    /**
     * @return the nn355c
     */
    public boolean isNn355c() {
        return nn355c;
    }

    /**
     * @param nn355c the nn355c to set
     */
    public void setNn355c(boolean nn355c) {
        this.nn355c = nn355c;
    }

    /**
     * @return the nn355p
     */
    public boolean isNn355p() {
        return nn355p;
    }

    /**
     * @param nn355p the nn355p to set
     */
    public void setNn355p(boolean nn355p) {
        this.nn355p = nn355p;
    }

    /**
     * @return the nd352c
     */
    public Date getNd352c() {
        return nd352c;
    }

    /**
     * @param nd352c the nd352c to set
     */
    public void setNd352c(Date nd352c) {
        this.nd352c = nd352c;
    }

    /**
     * @return the nd353c
     */
    public Date getNd353c() {
        return nd353c;
    }

    /**
     * @param nd353c the nd353c to set
     */
    public void setNd353c(Date nd353c) {
        this.nd353c = nd353c;
    }

    /**
     * @return the nd352p
     */
    public Date getNd352p() {
        return nd352p;
    }

    /**
     * @param nd352p the nd352p to set
     */
    public void setNd352p(Date nd352p) {
        this.nd352p = nd352p;
    }

    /**
     * @return the nd353p
     */
    public Date getNd353p() {
        return nd353p;
    }

    /**
     * @param nd353p the nd353p to set
     */
    public void setNd353p(Date nd353p) {
        this.nd353p = nd353p;
    }

    /**
     * @return the nn355
     */
    public int getNn355() {
        return nn355;
    }

    /**
     * @param nn355 the nn355 to set
     */
    public void setNn355(int nn355) {
        this.nn355 = nn355;
    }

    /**
     * @return the pn350c
     */
    public int getPn350c() {
        return pn350c;
    }

    /**
     * @param pn350c the pn350c to set
     */
    public void setPn350c(int pn350c) {
        this.pn350c = pn350c;
    }

    /**
     * @return the pn350p
     */
    public int getPn350p() {
        return pn350p;
    }

    /**
     * @param pn350p the pn350p to set
     */
    public void setPn350p(int pn350p) {
        this.pn350p = pn350p;
    }

    /**
     * @return the PT025
     */
    public int getPT025() {
        return PT025;
    }

    /**
     * @param PT025 the PT025 to set
     */
    public void setPT025(int PT025) {
        this.PT025 = PT025;
    }

    /**
     * @return the REFID
     */
    public int getREFID() {
        return REFID;
    }

    /**
     * @param REFID the REFID to set
     */
    public void setREFID(int REFID) {
        this.REFID = REFID;
    }

    /**
     * @return the TV026
     */
    public String getTV026() {
        return TV026;
    }

    /**
     * @param TV026 the TV026 to set
     */
    public void setTV026(String TV026) {
        this.TV026 = TV026;
    }

    /**
     * @return the TV027
     */
    public String getTV027() {
        return TV027;
    }

    /**
     * @param TV027 the TV027 to set
     */
    public void setTV027(String TV027) {
        this.TV027 = TV027;
    }

    /**
     * @return the TV028
     */
    public String getTV028() {
        return TV028;
    }

    /**
     * @param TV028 the TV028 to set
     */
    public void setTV028(String TV028) {
        this.TV028 = TV028;
    }

    /**
     * @return the TV029
     */
    public String getTV029() {
        return TV029;
    }

    /**
     * @param TV029 the TV029 to set
     */
    public void setTV029(String TV029) {
        this.TV029 = TV029;
    }

    /**
     * @return the TV030
     */
    public String getTV030() {
        return TV030;
    }

    /**
     * @param TV030 the TV030 to set
     */
    public void setTV030(String TV030) {
        this.TV030 = TV030;
    }

    /**
     * @return the nv112
     */
    public String getNv112() {
        return nv112;
    }

    /**
     * @param nv112 the nv112 to set
     */
    public void setNv112(String nv112) {
        this.nv112 = nv112;
    }

    /**
     * @return the menusub
     */
    public String getMenusub() {
        return menusub;
    }

    /**
     * @param menusub the menusub to set
     */
    public void setMenusub(String menusub) {
        this.menusub = menusub;
    }

    /**
     * @return the nv127
     */
    public String getNv127() {
        return nv127;
    }

    /**
     * @param nv127 the nv127 to set
     */
    public void setNv127(String nv127) {
        this.nv127 = nv127;
    }

    /**
     * @return the Offset
     */
    public int getOffset() {
        return Offset;
    }

    /**
     * @param Offset the Offset to set
     */
    public void setOffset(int Offset) {
        this.Offset = Offset;
    }

    /**
     * @return the Limit
     */
    public int getLimit() {
        return Limit;
    }

    /**
     * @param Limit the Limit to set
     */
    public void setLimit(int Limit) {
        this.Limit = Limit;
    }

    // property for paging
    /**
     * @return the current
     */
    public int getCurrent() {
        if (current > totalpage) {
            current = totalpage;
        } else if (current < 1) {
            current = 1;
        }
        return current;
    }

    /**
     * @param current the current to set
     */
    public void setCurrent(int current) {

        start = (current - 1) * getNumrow();
        end = current * numrow;
        this.current = current;
    }

    /**
     * @return the numrow
     */
    public int getNumrow() {
        if (numrow == 0) {
            numrow = 30;
        }
        return numrow;
    }

    /**
     * @param numrow the numrow to set
     */
    public void setNumrow(int numrow) {
        this.numrow = numrow;
    }

    /**
     * @return the start
     */
    public int getStart() {
        if (start == 0) {
            start = 1;
        }
        return start;
    }

    /**
     * @param start the start to set
     */
    public void setStart(int start) {
        this.start = start;
    }

    /**
     * @return the end
     */
    public int getEnd() {
        if (end == 0) {
            end = 20;
        }
        return end;
    }

    /**
     * @param end the end to set
     */
    public void setEnd(int end) {
        this.end = end;
    }

    /**
     * @return the totalrow
     */
    public int getTotalrow() {
        return totalrow;
    }

    /**
     * @param totalrow the totalrow to set
     */
    public void setTotalrow(int totalrow) {
//        if (totalrow == 0) {
//            totalrow = 100;
//        }
        totalpage = totalrow / numrow;

        if (totalrow % numrow > 0) {
            totalpage = totalpage + 1;
        }


        if (getTotalpage() <= 10) {
            setStartpage(1);
            setEndpage(getTotalpage());

        } else {
            setStartpage(current - 5);
            setEndpage(current + 5);


        }
        this.totalrow = totalrow;
    }

    /**
     * @return the startpage
     */
    public int getStartpage() {
        if (startpage < 1) {
            startpage = 1;
        }
        return startpage;
    }

    /**
     * @param startpage the startpage to set
     */
    public void setStartpage(int startpage) {
        this.startpage = startpage;
    }

    /**
     * @return the endpage
     */
    public int getEndpage() {
        if (endpage > totalpage) {
            endpage = totalpage;
        }
        return endpage;
    }

    /**
     * @param endpage the endpage to set
     */
    public void setEndpage(int endpage) {

        this.endpage = endpage;
    }

    /**
     * @return the totalpage
     */
    public int getTotalpage() {
//        if (totalpage == 0) {
//            totalpage = 10;
//        }
        return totalpage;
    }

    /**
     * @param totalpage the totalpage to set
     */
    public void setTotalpage(int totalpage) {
        this.totalpage = totalpage;
    }

    /**
     * @return the pagename
     */
    public String getPagename() {
        return pagename;
    }

    /**
     * @param pagename the pagename to set
     */
    public void setPagename(String pagename) {
        this.pagename = pagename;
    }

    /**
     * @return the totalcurent
     */
    public int getTotalcurent() {
        return totalcurent;
    }

    /**
     * @param totalcurent the totalcurent to set
     */
    public void setTotalcurent(int totalcurent) {
        this.totalcurent = totalcurent;
    }

    /**
     * @return the typesearchcurent
     */
    public int getTypesearchcurent() {
        return typesearchcurent;
    }

    /**
     * @param typesearchcurent the typesearchcurent to set
     */
    public void setTypesearchcurent(int typesearchcurent) {
        this.typesearchcurent = typesearchcurent;
    }

    /**
     * @return the empString
     */
    public String getEmpString() {
        return empString;
    }

    /**
     * @param empString the empString to set
     */
    public void setEmpString(String empString) {
        this.empString = empString;
    }

    /**
     * @return the groupN450
     */
    public List<SelectItem> getGroupN450() {
        if (groupN450 != null && groupN450.size() > 0) {
            return groupN450;
        } else {
            return comboboxUtil.getListComBN450();
        }

    }

    /**
     * @param groupN450 the groupN450 to set
     */
    public void setGroupN450(List<SelectItem> groupN450) {

        this.groupN450 = groupN450;
    }

    /**
     * @return the groupOther
     */
    public List<SelectItem> getGroupOther() {
        if (groupOther != null && groupOther.size() > 0) {
            return groupOther;
        } else {
            return comboboxUtil.getListCombK400F("N100E");
        }


    }

    /**
     * @param groupOther the groupOther to set
     */
    public void setGroupOther(List<SelectItem> groupOther) {
        this.groupOther = groupOther;
    }

    /**
     * @return the fk400
     */
    public int getFk400() {
        return fk400;
    }

    /**
     * @param fk400 the fk400 to set
     */
    public void setFk400(int fk400) {
        this.fk400 = fk400;
    }

    /**
     * @return the kv402
     */
    public String getKv402() {
        return kv402;
    }

    /**
     * @param kv402 the kv402 to set
     */
    public void setKv402(String kv402) {
        this.kv402 = kv402;
    }

    /**
     * @return the groupN850
     */
    public List<SelectItem> getGroupN850() {
        if (groupN850 != null && groupN850.size() > 0) {
            return groupN850;
        } else {
            return comboboxUtil.getlistCombN850FindId(fn450);

        }
    }

    /**
     * @param groupN850 the groupN850 to set
     */
    public void setGroupN850(List<SelectItem> groupN850) {
        this.groupN850 = groupN850;
    }

    /**
     * @return the fk600
     */
    public int getFk600() {
        return fk600;
    }

    /**
     * @param fk600 the fk600 to set
     */
    public void setFk600(int fk600) {
        this.fk600 = fk600;
    }

    /**
     * @return the nv973
     */
    public String getNv973() {
        return nv973;
    }

    /**
     * @param nv973 the nv973 to set
     */
    public void setNv973(String nv973) {
        this.nv973 = nv973;
    }

    /**
     * @return the nv974
     */
    public String getNv974() {
        return nv974;
    }

    /**
     * @param nv974 the nv974 to set
     */
    public void setNv974(String nv974) {
        this.nv974 = nv974;
    }

    /**
     * @return the nv975
     */
    public String getNv975() {
        return nv975;
    }

    /**
     * @param nv975 the nv975 to set
     */
    public void setNv975(String nv975) {
        this.nv975 = nv975;
    }

    // Excel for Employeee
    private Sheet createHeader(Sheet sheet, int row, HSSFCellStyle style) {
        List<SelectItem> header = new ArrayList<SelectItem>();
        header.add(new SelectItem(3000, "STT"));
        header.add(new SelectItem(5000, "Họ và tên"));
        header.add(new SelectItem(2000, "Giới tính"));
        header.add(new SelectItem(2000, "Ngày sinh"));
        header.add(new SelectItem(3000, "CMND"));
        header.add(new SelectItem(2000, "Ngày cấp"));
        header.add(new SelectItem(2000, "Ngày vào làm"));
        header.add(new SelectItem(2000, "Điện thoại"));
        header.add(new SelectItem(2000, "Địa chỉ"));
        header.add(new SelectItem(2000, "Tài khoản"));
        header.add(new SelectItem(3000, "Ngân Hàng"));
        Row row_header = sheet.createRow(row);
        for (int i = 0; i < header.size(); i++) {
            Cell c = row_header.createCell(i);
            c.setCellValue(header.get(i).getLabel());
            c.setCellStyle(style);
            sheet.setColumnWidth(i, Integer.parseInt(header.get(i).getValue().toString()));
        }
        return sheet;
    }

    public void exportExcel() {
        //String path = "E:\\qapi\\build\\web\\resources\\excel" + "\\report.xls";
        String s = getRequest().getRequestURL().toString();
        String[] arr = new String[20];
        arr = s.split("/");
        String url = "";
        if (arr.length > 3) {
            url = arr[0] + "/" + arr[1] + "/" + arr[2] + "/";
        }
        try {


            HSSFCellStyle styleTitle = (HSSFCellStyle) wb.createCellStyle();
            styleTitle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleTitle.setAlignment(CellStyle.ALIGN_CENTER);
            styleTitle.setWrapText(true);
            HSSFFont font = (HSSFFont) wb.createFont();
            font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
            font.setFontHeightInPoints((short) 12);
            font.setFontName("Arial");

            styleTitle.setFont(font);

            HSSFCellStyle styleHeader = (HSSFCellStyle) wb.createCellStyle();
            styleHeader.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleHeader.setAlignment(CellStyle.ALIGN_CENTER);
            styleHeader.setWrapText(true);
            styleHeader.setFillForegroundColor(HSSFColor.ROYAL_BLUE.index);
            styleHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
            styleHeader.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleHeader.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleHeader.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleHeader.setBorderTop(HSSFCellStyle.BORDER_THIN);

            HSSFFont font2 = (HSSFFont) wb.createFont();
            font2.setFontName("Arial");
            font2.setFontHeightInPoints((short) 10);
            font2.setFontHeightInPoints((short) 10);
            styleHeader.setFont(font2);


            HSSFCellStyle styleLeft = (HSSFCellStyle) wb.createCellStyle();
            styleLeft.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleLeft.setAlignment(CellStyle.ALIGN_LEFT);
            styleLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleLeft.setWrapText(true);

            HSSFCellStyle styleCenter = (HSSFCellStyle) wb.createCellStyle();
            styleCenter.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleCenter.setAlignment(CellStyle.ALIGN_CENTER);
            styleCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleCenter.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleCenter.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleCenter.setWrapText(true);

            HSSFCellStyle styleRight = (HSSFCellStyle) wb.createCellStyle();
            styleRight.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleRight.setAlignment(CellStyle.ALIGN_RIGHT);
            styleRight.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleRight.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleRight.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleRight.setWrapText(true);
//            HSSFFont font3 = (HSSFFont) wb.createFont();
//            font3.setFontName("Arial");
//            font3.setFontHeightInPoints((short) 10);
//
//            styleHeader.setFont(font3);


            Sheet sheet = wb.createSheet("Nhân Viên");

            Row rowTitle = sheet.createRow(currentRow);
            //new Region(currentRow,(short)0,currentRow,(short)10
            sheet.addMergedRegion(new CellRangeAddress(currentRow, currentRow, 0, 5));
            Cell cellTitle = rowTitle.createCell(0, 4);
            cellTitle.setCellValue("Danh sách Nhân viên");
            cellTitle.setCellStyle(styleTitle);

            currentRow = currentRow + 2;


            sheet = createHeader(sheet, currentRow, styleHeader);
            currentRow++;
            sheet = createContent(sheet, currentRow, styleLeft, styleCenter, styleRight);




            String tempStr = ResourcesProvider.getReportExcel();
            if (!(new File(tempStr)).exists()) {
                (new File(tempStr)).mkdirs();
            }
            //setup print
            PrintSetup ps = sheet.getPrintSetup();
            sheet.setAutobreaks(true);
            sheet.setMargin(Sheet.LeftMargin, 0.5);
            sheet.setMargin(Sheet.RightMargin, 0.5);

            ps.setLandscape(true);
            ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
            ps.setFitWidth((short) 0);
            ps.setFitHeight((short) 0);
            //end setup print

            File fileout = new File(ResourcesProvider.getReportExcel() + "report.xls");
            FileOutputStream fileOut = new FileOutputStream(fileout);
            wb.write(fileOut);
            fileOut.close();

            sendRedirect(url + "resources/excel/report.xls");

            System.out.println("sendRedirect----:" + ResourcesProvider.getReportExcel() + "report.xls");
//            sendRedirect("E://Q_//kapi//build//web//resources//excel//" + "report.xls");

        } catch (Exception e) {
        }




    }

    private Sheet createContent(Sheet sheet, int row, HSSFCellStyle left, HSSFCellStyle center, HSSFCellStyle right) {
        try {
            listEmployee = employeeStore.getListN100OutExcel(getLogin().getModule(), getLogin().getCompanyNo(), 0, 0, getLogin().getUserName());
            System.out.println("TUNG----------LIST--N100---------------- " + listEmployee.size());
            for (int i = 0; i < listEmployee.size(); i++) {
                try {


                    N100 v050 = listEmployee.get(i);
                    Row r = sheet.createRow(row);//ma tour
                    Cell c = r.createCell(0);
                    if (v050.getVv051() != null) {
                        c.setCellValue(v050.getVv051());
                    }
                    c.setCellStyle(center);
                    //Họ và tên
                    Cell c1 = r.createCell(1);
                    if (v050.getHoten() != null) {
                        c1.setCellValue(v050.getHoten());
                    }
                    c1.setCellStyle(left);
                    //giới tính
                    Cell c2 = r.createCell(2);
                    c2.setCellValue(v050.getNv107());
                    c2.setCellStyle(center);
                    //Ngày tháng năm sinh
                    Cell c3 = r.createCell(3);
                    //  c3.setCellValue(v050.getNd128());
                    try {
                        c3.setCellValue(sdf.format(Util.toSQLDate(v050.getNd128())));
                    } catch (Exception e) {
                    }
                    c3.setCellStyle(center);
                    //Số CMND	
                    Cell c4 = r.createCell(4);
                    c4.setCellValue(v050.getNv109());
                    c4.setCellStyle(right);
                    //Ngày cấp
                    Cell c5 = r.createCell(5);
                    try {
                        c5.setCellValue(sdf.format(Util.toSQLDate(v050.getNd352())));
                    } catch (Exception e) {
                    }
                    c5.setCellStyle(center);
                    //Ngày vào làm
                    Cell c6 = r.createCell(6);
                    try {
                        c6.setCellValue(sdf.format(Util.toSQLDate(v050.getNd124())));
                    } catch (Exception e) {
                    }
                    //  c6.setCellStyle(center);
                    //Điện thoại		
                    Cell c7 = r.createCell(7);
                    c7.setCellValue(v050.getNv121());
                    c7.setCellStyle(right);

                    //địa chỉ	
                    Cell c8 = r.createCell(8);
                    c8.setCellValue(v050.getNv112());
                    c8.setCellStyle(right);


                    c8.setCellStyle(center);
                    //tài khoản
                    Cell c9 = r.createCell(9);

                    c9.setCellValue(v050.getNv117());

                    c9.setCellStyle(center);
//                    Cell c9 = r.createCell(9);
//                    if (v050.getVn077() > 9 && v050.getVn078() > 9) {
//                        c8.setCellValue(v050.getVn077() + " : " + v050.getVn078());
//                    } else if (v050.getVn077() < 9 && v050.getVn078() > 9) {
//                        c9.setCellValue("0" + v050.getVn077() + " : " + v050.getVn078());
//                    } else if (v050.getVn077() > 9 && v050.getVn078() < 9) {
//                        c9.setCellValue(v050.getVn077() + " : 0" + v050.getVn078());
//                    }
//                    c8.setCellStyle(center);
                    //Ngân hàng
                    Cell c10 = r.createCell(10);

                    c10.setCellValue(v050.getNv118());

                    c10.setCellStyle(center);

//
//                    c12.setCellStyle(left);
//                    //trang thai
//                    Cell c13 = r.createCell(13);
//                    if (v050.getVv066() != null) {
//                        if (v050.getVv066().equals("T")) {
//                            c13.setCellValue("Tour");
//                        } else {
//                           c13.setCellValue("Sale");
//                        }
//                    }

//                    c13.setCellStyle(center);
//                    //mo ta
//                    Cell c14 = r.createCell(14);
//                    SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
//                    if (v050.getVl098()!= null && v050.getVl099()!= null) {
//                        try {
//                            c14.setCellValue(sdf1.format(Util.toSQLDate(v050.getVl098())) + v050.getVl099());
//                        } catch (Exception e) {
//                            c14.setCellValue(v050.getVl099());
//                            
//                        }
//                    }
//
//                    c14.setCellStyle(center);
                    row++;
                } catch (Exception e) {
                    System.out.println("D:-error from  row: " + i + " -- " + e.getMessage());
                    continue;
                }

            }
        } catch (Exception e) {
            System.out.println("D:-error from ExportExel: " + e.getMessage());
        }
        return sheet;
    }

    /**
     * @return the startDT
     */
    public Date getStartDT() {
        return startDT;
    }

    /**
     * @param startDT the startDT to set
     */
    public void setStartDT(Date startDT) {
        this.startDT = startDT;
    }

    /**
     * @return the endDT
     */
    public Date getEndDT() {
        return endDT;
    }

    /**
     * @param endDT the endDT to set
     */
    public void setEndDT(Date endDT) {
        this.endDT = endDT;
    }

    /**
     * @return the tabString
     */
    public String getTabString() {
        if (SessionProvider.getSessionMapValue("TABLL") != null) {
            tabString = SessionProvider.getSessionMapValue("TABLL").toString();
        } else {
        }
        return tabString;
    }

    /**
     * @param tabString the tabString to set
     */
    public void setTabString(String tabString) {
        this.tabString = tabString;
    }

    public void chooseTabll() {
        try {
            setTabString("TABLL");
            SessionProvider.setSessionMapValue("TABLL", tabString);
            listSelected.clear();
            if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                SessionProvider.setSessionMapValue("listSelectedEx", null);
            }
            if (SessionProvider.getSessionMapValue("listN100") != null) {
                SessionProvider.setSessionMapValue("listN100", null);
            }

        } catch (Exception e) {
        }
    }

    public void chooseTabCN() {
        try {
            setTabString("TABCN");
            SessionProvider.setSessionMapValue("TABLL", tabString);
            listSelected.clear();
            if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                SessionProvider.setSessionMapValue("listSelectedEx", null);
            }
            if (SessionProvider.getSessionMapValue("listN100") != null) {
                SessionProvider.setSessionMapValue("listN100", null);
            }

        } catch (Exception e) {
        }
    }

    public void chooseTabCM() {
        try {
            setTabString("TABCM");
            SessionProvider.setSessionMapValue("TABLL", tabString);
            listN500DB = (List<N500>) SessionProvider.getSessionMapValue("listN500");
            setTabString("TABCN");
            listSelected.clear();
            if (SessionProvider.getSessionMapValue("listSelectedEx") != null) {
                SessionProvider.setSessionMapValue("listSelectedEx", null);
            }
            if (SessionProvider.getSessionMapValue("listN100") != null) {
                SessionProvider.setSessionMapValue("listN100", null);
            }
        } catch (Exception e) {
        }
    }

    public void chooseTabTK() {
        try {
            setTabString("TABTK");
            SessionProvider.setSessionMapValue("TABLL", tabString);
        } catch (Exception e) {
        }
    }

    public void chooseTabTL() {
        try {
            setTabString("TABTL");
            SessionProvider.setSessionMapValue("TABLL", tabString);
        } catch (Exception e) {
        }
    }

    /**
     * @return the listAllEmp
     */
    public List<N100> getListAllEmp() {
        try {
            listAllEmp = employeeStore.getAllListTabN100All(getLogin().getModule(), getLogin().getCompanyNo(), 0, 0, 0, 0, null, Offset, 100, 0, 0, getLogin().getUserName());
        } catch (Exception e) {
        }
        return listAllEmp;
    }

    /**
     * @param listAllEmp the listAllEmp to set
     */
    public void setListAllEmp(List<N100> listAllEmp) {
        this.listAllEmp = listAllEmp;
    }

    /**
     * @return the check
     */
    public boolean isCheck() {
        return check;
    }

    /**
     * @param check the check to set
     */
    public void setCheck(boolean check) {
        this.check = check;
    }

    /**
     * @return the listEmployeeDB
     */
    public List<N100> getListEmployeeDB() {
        return listEmployeeDB;
    }

    /**
     * @param listEmployeeDB the listEmployeeDB to set
     */
    public void setListEmployeeDB(List<N100> listEmployeeDB) {
        this.listEmployeeDB = listEmployeeDB;
    }

    /**
     * @return the listN500DB
     */
    public List<N500> getListN500DB() {
        return listN500DB;
    }

    /**
     * @param listN500DB the listN500DB to set
     */
    public void setListN500DB(List<N500> listN500DB) {
        this.listN500DB = listN500DB;
    }
}
